package edu.bit.water.controller;

import edu.bit.water.entity.EntityClassifiedStandard;
import edu.bit.water.entity.EntityWaterCount;
import edu.bit.water.entity.MetaQSDEsub;
import edu.bit.water.service.MetaQSDEsubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/meta_QSDEsub")
public class MetaQSDEsubController {

    @Autowired
    private MetaQSDEsubService metaQSDEsubService;

    @ResponseBody
    @RequestMapping(value = "/select", method=RequestMethod.GET)
    public Map<String, Object> queryQSDEsub(String stNumber) {
        Map<String, Object> result = new HashMap<>();
        List<MetaQSDEsub> list = metaQSDEsubService.queryQSDEsub(stNumber);
        result.put("rows", list);
        return result;
    }

    @ResponseBody
    @RequestMapping("/insert")
    public Map<String, Object> insertMetaQSDEsub(MetaQSDEsub metaQSDEsub) {
        metaQSDEsub.showContent();
        Map<String, Object> result = metaQSDEsubService.insertMetaQSDEsubService(metaQSDEsub);
        return result;
    }

    /**
     * 删除metaQSDEsub
     * author Page
     */
    @ResponseBody
    @RequestMapping("/delete")
    public Map<String, Object> deleteMetaQSDEsub(@RequestBody List<String>metaQSDEsub) {
        return metaQSDEsubService.deleteMetaQSDEsub(metaQSDEsub);
    }

    /**
     * 级联删除
     * author Page
     */
    @ResponseBody
    @RequestMapping("/water_count_delete")
    public Map<String, Object> waterCountDelete(@RequestBody List<String> tempData) {
        return metaQSDEsubService.waterCountDelete(tempData);
    }

    @ResponseBody
    @RequestMapping("/update")
    public Map<String, Object> updateMetaQSDEsub(MetaQSDEsub metaQSDEsub) {
        Map<String, Object> result = metaQSDEsubService.updateMetaQSDEsubService(metaQSDEsub);
        return result;
    }

    /**
     * 级联编辑
     * author Page
     */
    @ResponseBody
    @RequestMapping("/water_count_update")
    public Map<String, Object> waterCountUpdate(EntityWaterCount entityWaterCount) {
        return metaQSDEsubService.waterCountUpdate(entityWaterCount);
    }
}
